package com.yanqu.road.entity.qixi;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.property.Property;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@FieldTypeAnnotation(tableName = "t_u_qixi", desc = "七夕玩家数据")
public class UserQixiData extends DataObject {
    @FieldTypeAnnotation(select = true, update = true, desc = "活动id")
    private int activityId;
    @FieldTypeAnnotation(select = true, update = true, desc = "用户id")
    private long userId;
    @FieldTypeAnnotation(desc = "收花数,榜单值")
    private int getFlowerCount;
    @FieldTypeAnnotation(desc = "送花数,成就值")
    private int sendFlowerCount;
    @FieldTypeAnnotation(desc = "花1的累计")
    private int dayCount1;
    @FieldTypeAnnotation(desc = "花2的累计")
    private int dayCount2;
    @FieldTypeAnnotation(desc = "花3的累计")
    private int dayCount3;
    @FieldTypeAnnotation(desc = "最近一次收花时间")
    private long lastGetTime;
    @FieldTypeAnnotation(desc = "已经领了的广播奖励")
    private Set<Long> getBroadcastList = new HashSet<>();
    @FieldTypeAnnotation(desc = "已经收到的广播奖励")
    private Set<Long> watchBroadcastList = new HashSet<>();
    @FieldTypeAnnotation(desc = "最近一次收到广播的时间")
    private long lastWatchTime;

    public UserQixiData(int activityId, long userId) {
        this.activityId = activityId;
        this.userId = userId;
        setInsertOption();
    }

    public UserQixiData() {
    }

    public int getActivityId() {
        return activityId;
    }
    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }
    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public int getGetFlowerCount() {
        return getFlowerCount;
    }
    public void setGetFlowerCount(int getFlowerCount) {
        if (this.getFlowerCount != getFlowerCount) {
            this.getFlowerCount = getFlowerCount;
            setOp(DataStatus.Update);
        }
    }

    public int getSendFlowerCount() {
        return sendFlowerCount;
    }
    public void setSendFlowerCount(int sendFlowerCount) {
        if (this.sendFlowerCount != sendFlowerCount) {
            this.sendFlowerCount = sendFlowerCount;
            setOp(DataStatus.Update);
        }
    }

    public int getDayCount1() {
        return dayCount1;
    }
    public void setDayCount1(int dayCount1) {
        if (this.dayCount1 != dayCount1) {
            this.dayCount1 = dayCount1;
            setOp(DataStatus.Update);
        }
    }

    public int getDayCount2() {
        return dayCount2;
    }
    public void setDayCount2(int dayCount2) {
        if (this.dayCount2 != dayCount2) {
            this.dayCount2 = dayCount2;
            setOp(DataStatus.Update);
        }
    }

    public int getDayCount3() {
        return dayCount3;
    }
    public void setDayCount3(int dayCount3) {
        if (this.dayCount3 != dayCount3) {
            this.dayCount3 = dayCount3;
            setOp(DataStatus.Update);
        }
    }

    public long getLastGetTime() {
        return lastGetTime;
    }
    public void setLastGetTime(long lastGetTime) {
        if (this.lastGetTime != lastGetTime) {
            this.lastGetTime = lastGetTime;
            setOp(DataStatus.Update);
        }
    }

    public Set<java.lang.Long> getGetBroadcastList() {
        return getBroadcastList;
    }
    public void setGetBroadcastList(HashSet<java.lang.Long> getBroadcastList) {
        if (null == getBroadcastList){
            return;
        }
        if (this.getBroadcastList == null || !this.getBroadcastList.equals(getBroadcastList)) {
            this.getBroadcastList = getBroadcastList;
            setOp(DataStatus.Update);
        }
    }

    public void addBroadcastId(long broadcastId){
        this.getBroadcastList.add(broadcastId);
        setUpdateOption();
    }

    public Set<Long> getWatchBroadcastList() {
        return watchBroadcastList;
    }

    public void setWatchBroadcastList(HashSet<Long> watchBroadcastList) {
        this.watchBroadcastList = watchBroadcastList;
    }

    public void addWatchBroadcastId(long broadcastId){
        this.watchBroadcastList.add(broadcastId);
        this.setLastWatchTime(DateHelper.getCurrentTime());
        setUpdateOption();
    }

    public boolean wasGetBroadcast(long broadcastId){
        return this.getBroadcastList.contains(broadcastId);
    }

    public boolean wasWatchBroadcast(long broadcastId){
        return this.watchBroadcastList.contains(broadcastId);
    }

    public long getLastWatchTime() {
        return lastWatchTime;
    }

    public void setLastWatchTime(long lastWatchTime) {
        if (this.lastWatchTime != lastWatchTime) {
            this.lastWatchTime = lastWatchTime;
            setOp(DataStatus.Update);
        }
    }
}
